﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ContentRotator.Model
{
    public class TwitterFeed
    {
        public const string TWITTER_URL_FORMAT = "http://www.twitter.com/{0}"; //TODO: externalise this in a config file

        public string TwitterUsername { get; set; }
        public int NumTweets { get; set; }
        public int MaxHistory { get; set; }
        public string MoreInfoURL { get { return String.Format(TWITTER_URL_FORMAT, TwitterUsername); } }

        public event ImpressionEventHandler Impression;
        public event MoreInfoEventHandler MoreInfo;

        public int ID { get; set; }
        public string Tag { get; set; }
        public bool Enabled { get; set; }
        public DateTime Added { get; set; }

        private int _impressionCount;
        public int ImpressionCount { get { return _impressionCount; } }
        private int _moreInfoCount;
        public int MoreInfoCount { get { return _moreInfoCount; } }


        public void RecordImpression()
        {
            _impressionCount++;

            if (Impression != null)
                Impression(this.ImpressionCount);
        }

        public void RecordMoreInfo()
        {
            _moreInfoCount++;

            if (MoreInfo != null)
                MoreInfo(this.MoreInfoCount);
        }


    }
}
